package org.cupk2.luser.events;

import lombok.extern.slf4j.Slf4j;
import org.cupk2.base.event.F2Event;
import org.cupk2.base.event.enums.F2EActionT;
import org.cupk2.base.event.inter.Cupk2EventHandle;
import org.cupk2.luser.service.LocalUserServiceInter;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Slf4j
@Service
public class EventLoginHandle implements Cupk2EventHandle {

    @Autowired
    private LocalUserServiceInter localUserServiceImpl;

    @Override
    public void handle(F2Event event) {
        if (event.getAction().getType().equals(F2EActionT.LOGIN)) {

            localUserServiceImpl.updateLoginTime(event.getAction().getOperator().getUserKey());
        }
    }
}
